package com.jf.identity.controller;

import com.jf.identity.entity.FoulFeedBackBatch;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.service.FoulCodeService;
import com.jf.identity.util.Params;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by x on 2018/4/13.
 */
@Controller
@RequestMapping("/cdm/")
public class FoulCodeController {
    @Resource
    private FoulCodeService foulCodeService;

    @RequestMapping(value = "get-foulcode")
    @ResponseBody
    public ResponseBean getFoulcode() {
        return new ResponseBean(foulCodeService.getFoulCodes());
    }

    /**
     * 批量上传(取消)缺考/违纪信息
     *
     * @param foulFeedBackBatch 考生信息
     * @return 是否成功
     */
    @RequestMapping(value = "set-examinee-foul-info")
    @ResponseBody
    public ResponseBean setExamineeFoulBatch(@Validated @RequestBody FoulFeedBackBatch foulFeedBackBatch,
                                             BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        return new ResponseBean(foulCodeService.setFoulInfoBatch(foulFeedBackBatch));
    }
}

















